<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>Document</title>
    <link rel="stylesheet" href="./lib/css/swiper.min.css">
    <style>
        html, body, #pageWp {
            width: 100%;
            height: 100%;
        }
        body {
            margin: 0;
            padding: 0;
        }
        #navBar .swiper-slide.active {
            background-color: red;
            color: #fff;
        }
    </style>
</head>
<body>

    <div id="navBar" class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide active">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
            <div class="swiper-slide">Slide 6</div>
            <div class="swiper-slide">Slide 7</div>
            <div class="swiper-slide">Slide 8</div>
            <div class="swiper-slide">Slide 9</div>
            <div class="swiper-slide">Slide 10</div>
        </div>
    </div>

    <div id="pageWp" class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Page 1</div>
            <div class="swiper-slide">Page 2</div>
            <div class="swiper-slide">Page 3</div>
            <div class="swiper-slide">Page 4</div>
            <div class="swiper-slide">Page 5</div>
            <div class="swiper-slide">Page 6</div>
            <div class="swiper-slide">Page 7</div>
            <div class="swiper-slide">Page 8</div>
            <div class="swiper-slide">Page 9</div>
            <div class="swiper-slide">Page 10</div>
        </div>
    </div>

    <script src="./lib/zepto.min.js" charset="utf-8"></script>
    <script src="./lib/swiper.min.js"></script>
    <script>
        /*var pageWp, navBar;
        pageWp = new Swiper('#pageWp', {
            onSlideChangeEnd: function(swiper){
                var index = swiper.activeIndex;
                navBar.slideTo(index, 500, false);
                activeItem(index);
            }
        });
        navBar = new Swiper('#navBar', {
            slidesPerView: 4,
            spaceBetween: 5,
            onClick: function(swiper){
                var index = swiper.clickedIndex;
                navBar.slideTo(index, 500, false);
                pageWp.slideTo(index, 100, false);
                activeItem(index);
            }
        });*/
        function activeItem(index) {
            var $navBar = $('#navBar');
            $navBar
                .find('.swiper-slide').eq(index).addClass('active')
                .siblings('.active').removeClass('active');
        }
        /////////////////////////////////////////////////////////
        var pageWp = new Swiper('#pageWp', {
            initialSlide: 2,
            onSlideChangeEnd: function(swiper){
                var index = swiper.activeIndex;
                activeItem(index);
            }
        });
        var navBar = new Swiper('#navBar', {
            slidesPerView: 4,
            onClick: function(swiper){
                var index = swiper.clickedIndex;
                activeItem(index);
            }
        });
        $('#navBar').on('click', '.swiper-slide', function() {
            var index = $(this).index();
            pageWp.slideTo(index);
        });
        pageWp.params.control = navBar;
        navBar.params.control = pageWp;
    </script>

</body>
</html>